﻿<?php 
include("conn.php");
mysql_query('SET NAMES UTF8'); 

class MyPrizeBean {
	public $dizhiid;
	public $name;
	public $dizhi;
	public $dianhua;
	public $state;
	
	function __construct($dizhiid,$name,$dizhi,$dianhua,$state) {
		$this->dizhiid = $dizhiid;
		$this->name    = $name;
		$this->dizhi   = $dizhi;
		$this->dianhua = $dianhua;
		$this->state   = $state;
	}
}

if($_REQUEST[did]!="") {
	$states2=0;
	$states=1;
	$srat=mysql_query("update address set state='".$states2."' where state='".$states."' and  userid ='".$_REQUEST[userid]."'");
	$srat=mysql_query("update address set state='".$states."' where id='".$_REQUEST[did]."'");
}

$rert30=mysql_query("select *from address where  userid ='".$_REQUEST[userid]."'  order by id desc");
$prize = array();
while($rowf=mysql_fetch_array($rert30)) {        
	$address = $rowf[province].",".$rowf[city].",".$rowf[quyu].",".$rowf[address];
	$prize[] = new MyPrizeBean($rowf[id],$rowf[name],$address,$rowf[tel],$rowf[state]);
}

echo json_encode($prize);